<template>
  <div v-if="honor_know">
    <div class="title">知识产权荣誉：{{ honor_know.count }}</div>
    <div class="know" v-if="!PdfType">
      <div v-for="item in honor_know.list" :class="item.count ? 'have' : ''" class="item">
        {{ item.name }}{{ item.count ? `x${item.count}` : "" }}
      </div>
    </div>
    <div v-else>
      <div v-for="item in honor_know.list">
        <div v-if="item.count" class="have">{{ item.name }}{{ item.count ? `x${item.count}` : "" }}</div>
      </div>
    </div>

    <div v-if="companyInfoIndustry.honor_other">
      <div class="title">其他荣誉：{{ companyInfoIndustry.honor_other.count ? companyInfoIndustry.honor_other.count : 0 }}
      </div>
      <div class="table" v-if="!PdfType">
        <el-table :data="companyInfoIndustry.honor_other.list ? companyInfoIndustry.honor_other.list.slice(0, 10) : []"
          border style="width: 100%" :header-cell-style="{ background: '#f0f7fc' }">
          <el-table-column type="index" label="序号" width="55"> </el-table-column>
          <el-table-column prop="startDate" label="发证日期" width="130">
          </el-table-column>
          <el-table-column prop="certificateName" label="证书类型"> </el-table-column>
          <el-table-column prop="certNo" label="证书编号"> </el-table-column>
          <el-table-column prop="endDate" label="截止日期" width="130"> </el-table-column>
        </el-table>
        <div class="more" @click="moreAdd(1)">查看全部</div>
      </div>
      <div v-else>
        <table  border="1" v-if="companyInfoIndustry.honor_other.list.length">
          <tr class="tableTr">
            <th class="tableTh" align="center">序号</th>
            <th class="tableTh" align="center">发证日期</th>
            <th class="tableTh" align="center">证书类型</th>
            <th class="tableTh" align="center">证书编号</th>
            <th class="tableTh" align="center">截止日期</th>
          </tr>
          <tr class="tableTr" v-for="(item, index) in companyInfoIndustry.honor_other.list ? companyInfoIndustry.honor_other.list.slice(0, 10) : []" :key="'companyInfoIndustry.honor_other.list' + index">
            <td class="tableTd" align="center">{{ index + 1 }}</td>
            <td class="tableTd" align="center">
              {{ item.startDate }}
            </td>
            <td class="tableTd" align="center">{{ item.certificateName }}</td>
            <td class="tableTd" align="center">{{ item.certNo }}</td>
            <td class="tableTd" align="center">
              {{ item.endDate }}
            </td>
          </tr>
        </table>
        <div v-else class="legendText">暂无数据</div>

        <div v-if="companyInfoIndustry.honor_other.list.length > 10 && PdfType"
        style="margin-top: 5px;">**以上表格仅展示部分数据，更多信息请登录优专平台查看（zf.youpat.cn）</div>
      </div>
    </div>
  </div>
</template>

<script>
import { } from "@/api/newuser";
export default {
  data() {
    return {
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄",
        },
      ],
    };
  },
  watch: {
    "form_admin.company": {
      handler(newV, oldV) { },
      deep: true,
    },
  },
  filters: {},
  props: {
    PdfType: {
      type: Boolean,
      default: false,
    },
    form_admin: {
      type: Object,
      default: () => ({}),
    },
    companyInfoIndustry: {
      type: Object,
      default: () => { },
    },
    honor_know: {
      type: Object,
      default: () => { },
    }
  },
  components: {},
  mounted() { },
  methods: {
    moreAdd(type) {
      // this.$router.push({
      //   path: "/morePatents",
      //   query: {
      //     patentType: type,
      //     company_id: this.companyInfoIndustry.company_id 
      //   },
      // });
      console.log(this.form_admin, 'this.form_admin');

      let routerJump = this.$router.resolve({
        path: "/morePatents",
        query: {
          patentType: type,
          company_id: this.companyInfoIndustry.company_id,
          companyName: this.form_admin.company,
        },
      });
      window.open(routerJump.href, "_blank");
    },
  },
};
</script>

<style scoped lang="less">
.more {
  text-align: center;
  padding: 20px;
  border-bottom: 1px solid #ebeef5;
  cursor: pointer;
}

::v-deep .el-table__row {
  td:nth-child(1) {
    text-align: center;
  }
}

.title {
  font-size: 18px;
  font-weight: bold;
}

.table {
  padding: 20px 0px;
}

.know {
  display: flex;
  // justify-content: space-between;
  padding: 20px 30px;
  flex-wrap: wrap;

  .item {
    font-size: 18px;
    color: #afb0b0;
    margin-right: 55px;
    margin-bottom: 20px;
  }

  .have {
    color: #377fff;
    font-weight: bold;
  }
}

@media (max-width: 1360px) {}

@media (max-width: 1280px) {}

@media (max-width: 768px) {}
</style>
